<template>
  <a-modal
    :visible="visible"
    title="审核"
    :width="900"
    :bodyStyle="{
      height: '500px',
      overflow: 'auto'
    }"
    @cancel="() => { $emit('cancel') }"
  >
    <!-- <a-row>
        <a-col :span="12">
            <p>入学照片：</p>
            <img class="pic" :src="zpdz" width="200" alt="">
        </a-col>
    </a-row> -->
    <!-- <detail-list :col="2">
      <detail-list-item term="入学照片"><img class="pic" :src="zpdz" width="200" alt=""></detail-list-item>
      <detail-list-item term="毕业照片"><img class="pic" :src="byzp" alt=""></detail-list-item>
    </detail-list> -->
    <a-form :form="form">
        <a-col :span="12">
            <a-form-item
                label="入学照片"
                :labelCol="{span: 5,offset: 1}"
                :wrapperCol="{span: 17, offset: 1}">
                <img class="pic" :src="zpdz" alt="">
            </a-form-item>
        </a-col>
        <a-col :span="12">
            <a-form-item
                label="毕业照片"
                :labelCol="{span: 5,offset: 1}"
                :wrapperCol="{span: 17, offset: 1}">
                <img class="pic" :src="byzp" alt="">
            </a-form-item>
        </a-col>
        <a-col :span="12" >
            <a-form-item
                label="审核结果"
                :labelCol="{span: 5,offset: 1}"
                :wrapperCol="{span: 17, offset: 1}">
                <a-select v-decorator="['shzt',
                {
                    rules: [{ required: true, message: '请选择审核结果!' }],
                }]" :disabled="type == 'see'">
                <!-- <a-select-option v-for="i in TYPE0339" :key="i.id" :value="i.code">{{ i.name }}</a-select-option> -->
                <a-select-option value="01">审核不通过</a-select-option>
                <a-select-option value="02">审核通过</a-select-option>
                </a-select>
            </a-form-item>
        </a-col>
    </a-form>
    <div slot="footer">
      <!-- <a-button v-if="!isCredit" @click="exportPrint(0)" type="primary">打印中文成绩单</a-button>
      <a-button v-if="!isCredit" @click="exportPrint(1)" type="primary">打印英文成绩单</a-button> -->
      <a-button v-if="byzp&&zpdz&&type == 'check'" type="primary" @click="onOk">审核</a-button>
      <a-button @click="() => { $emit('cancel') }">关闭</a-button>
    </div>
  </a-modal>
</template>

<script>
import DetailList from '~/tool/DetailList'
const DetailListItem = DetailList.Item

export default {
    props: ['visible','infoList','type'],
    components: {DetailList, DetailListItem},
    data () {
        return {
            form: this.$form.createForm(this),
            zpdz: '',
            byzp: ''
        }
    },
    watch:{
        visible(value){
            if(value){
                console.log(this.infoList)
                this.$nextTick(() => {
                    if(this.type == 'see'){
                        console.log(this.infoList.zpshzt)
                        this.form.setFieldsValue({
                            shzt: this.infoList.zpshzt
                        })
                    }else{
                        this.form.setFieldsValue({
                            shzt: '02'
                        })
                    }
                })
                console.log(value)
                this.info()
            }
        }
    },
    methods: {
        info(){
            this.$api.cultivate.infoPic({xh: this.infoList.xh}).then((res) => {
                this.zpdz = res.data.zpdz
                this.byzp = res.data.byzp
            })
        },
        onOk(){
            this.form.validateFields((err, values) => {
                if (err) {
                    return
                }
                let formData = {
                    xh: this.infoList.xh,
                    shzt: values.shzt
                }
                this.$emit('save', formData)

            })

        }
    }
}
</script>

<style>
.pic{
    width: 250px;
    height: 330px;
}
</style>
